package com.piggy.logi.sys.mapper;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.piggy.common.core.web.page.BaseMapperPlus;
import com.piggy.logi.sys.domain.LogiWaybillCarrier;

import java.util.List;

/**
 * 运单承运信息Mapper接口
 */
public interface LogiWaybillCarrierMapper extends BaseMapperPlus<LogiWaybillCarrier> {

    default void updateByUK(LogiWaybillCarrier carrier) {
        update(carrier, Wrappers.<LogiWaybillCarrier>lambdaUpdate()
                .eq(LogiWaybillCarrier::getDeptId, carrier.getDeptId())
                .eq(LogiWaybillCarrier::getWaybillId, carrier.getWaybillId()));
    }

    default void removeByUK(Long deptId, Long waybillId) {
        delete(Wrappers.<LogiWaybillCarrier>lambdaQuery()
                .eq(LogiWaybillCarrier::getDeptId, deptId)
                .eq(LogiWaybillCarrier::getWaybillId, waybillId));
    }

    default List<LogiWaybillCarrier> selectByWaybillIds(List<Long> waybillIds) {
        return selectList(Wrappers.<LogiWaybillCarrier>lambdaQuery().in(LogiWaybillCarrier::getWaybillId, waybillIds));
    }
}
